package com.ling.rabbitmq.obj;

import com.ling.rabbitmq.model.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ObjectSender {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send(User user) throws InterruptedException {
        System.out.println("Sender object: " + user.toString());
        this.amqpTemplate.convertAndSend("obj",user);
        Thread.sleep(500);
    }
}
